fix(coinpayportal): add coin.chain fallback to coinToPaymentCurrency#291
fix(coinpayportal): add coin.chain fallback to coinToPaymentCurrency#291emil07770 wants to merge 1 commit into
Conversation
CoinPay's /api/oauth/userinfo returns wallets as {address, chain: "SOL"} (not symbol). The symbol computation in coinToPaymentCurrency never checked coin.chain, so SOL wallets were never recognized and invoices failed with "Select a CoinPay receiving wallet" error.
Greptile SummaryThis PR fixes a bug where SOL wallets returned by CoinPay's
Confidence Score: 4/5The change is a minimal, well-targeted fallback that resolves the stated SOL wallet recognition failure; safe to merge for native-coin wallets. The two-line fix works correctly for any wallet where the only identifier is Only Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["coinToPaymentCurrency(coin)"] --> B["Check directCurrency\n(coin.currency, coin.id, coin.code)"]
B -- "Match in SUPPORTED_CURRENCIES" --> C["Return matched SupportedCurrency"]
B -- "No match" --> D["Compute symbol\ncoin.symbol || coin.code ||\ncoin.currency || coin.id\n|| coin.chain ← NEW"]
D --> E["Compute chain\ncoin.chain || coin.network\n|| coin.blockchain"]
E --> F{symbol?}
F -- "BTC/BCH/ETH/POL/SOL" --> G["Return single-asset currency\ne.g. 'sol', 'eth'"]
F -- "USDT" --> H{"chain?\nPOL / SOL / ETH"}
H --> I["Return 'usdt_pol' / 'usdt_sol' / 'usdt_eth' / 'usdt'"]
F -- "USDC" --> J{"chain?\nPOL / ETH"}
J --> K["Return 'usdc_pol' / 'usdc_eth' / 'usdc_sol'"]
F -- "no match" --> L["Return null"]
|
CoinPay's /api/oauth/userinfo returns wallets as {address, chain: "SOL"} (not symbol). The symbol computation in coinToPaymentCurrency never checked coin.chain, so SOL wallets were never recognized and invoices failed with "Select a CoinPay receiving wallet" error.